<extend name="Public:common"/>
<block name="css">
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css"  media="all">
    <style>
        .breadcrumb li{font-size:120%;padding:10px;}
        .dayList{ border-bottom:#ddd solid 2px;}
        .breadcrumb > li.active{background:#87b87f; color:#fff;}
        th{text-align:center;}
        td{text-align:center;}
        .operator{width:80px;}
    </style>
</block>
<block name="content">
 <div class="page-header" style="background-color: #fff!important"><h1><i class="fa fa-home"></i> 首页 &gt;产品管理&gt;线路发布</h1></div>
    <ul id="nav" class="nav nav-tabs">
        <li role="presentation" class=""><a href="javascript:void(0)">第一步基本信息</a></li>
        <li role="presentation" class=""><a href="javascript:void(0)">第二步价格计划</a></li>
        <li role="presentation" class="active"><a href="javascript:void(0)">第三步行程安排</a></li>
        <li role="presentation" class=""><a href="javascript:void(0)">第四步签证添加</a></li>
        <li role="presentation" class=""><a href="javascript:void(0)">第五步附加产品</a></li>
    </ul>

    <div class="tab-content">
        <!-- 行程安排 第三步-->
        <form action="{:U('step3_action')}" method="post" class="form-horizontal">
            <input type="hidden" name="id" value="{:I('id')}">
            <div class="dayList" >
                <ul class="breadcrumb ">
                    <volist name="trip" id="vo">
                        <li <if condition="$vo['current_day']==1"> class="active"</if>>第{$i}天</li>
                    </volist>
                </ul>
            </div>
            <br>
            <volist name="trip" id="vo">
                <div class="day-item"  style="display:<if condition="$vo['current_day']==1">block<else/>none</if>">
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>行程标题：</label>
                        <div class="col-sm-8">
                            <input required type="text" name="day[{$vo.current_day}][trip_title]" class="form-control" value="{$vo.trip_title}"  placeholder="行程标题">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>线路特色：</label>
                        <div class="col-sm-8">
                            <input required type="text" class="form-control" name="day[{$vo.current_day}][features]" value="{$vo.features}" placeholder="线路特色">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>用餐：</label>
                        <div class="col-sm-8">
                            <input class="form-checkbox" type="checkbox" width="30"  <if condition="strstr($vo['dining'],'早餐')">checked</if> name="day[{$vo.current_day}][dining][]" value="早餐" id="morning"><label for="morning">早餐</label>
                            <input class="form-checkbox" type="checkbox" width="30" <if condition="strstr($vo['dining'],'中餐')">checked</if> name="day[{$vo.current_day}][dining][]" value="中餐" id="noon"><label for="noon">中餐</label>
                            <input class="form-checkbox" type="checkbox" width="30"  <if condition="strstr($vo['dining'],'晚餐')">checked</if> name="day[{$vo.current_day}][dining][]" value="晚餐" id="night"><label for="night">晚餐</label>
                        </div>
                    </div>

                <div class="form-group">
                    <label for="" class="col-sm-2 control-label"><font color="red">*</font>住宿：</label>
                    <div class="col-sm-8">
                        <volist name="vo['hotel']" id="hotel">
                            <label  style="margin-right:20px;" for="day[{$vo.current_day}][lodging][{$i}]">{$hotel.supplier_name}-{$hotel.room_name}<!-- -{$hotel.star_level}星级-房间数{$hotel.room_count}-成人{$hotel.adult_actual_cost}元-儿童{$hotel.child_actual_cost}元-->
                                <input type="checkbox" id="day[{$vo.current_day}][lodging][{$i}]"  name="day[{$vo.current_day}][lodging][]" {$hotel.checked} value="{$hotel.room_priceId}"></label>
                        </volist>
                        <!--<input type="text"  name="day[{$vo.current_day}][lodging]" value="{$vo.lodging}" class="form-control" placeholder="住宿">-->
                        <hr>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label"><font color="red">*</font>可选升级酒店：</label>
                    <div class="col-sm-8">
                        <volist name="vo['upgradeHotel']" id="p_hotel">
                            <h5>{$p_hotel.supplier_name}:</h5>
                            <volist name="p_hotel['child']" id="s_hotel">
                                <label  style="margin-right:20px;"   for="day[{$vo.current_day}][upgrade_lodging][{$s_hotel.room_price_id}]">{$s_hotel.room_name}<!-- -{$s_hotel.star_level}星级-房间数{$s_hotel.room_count}-成人{$s_hotel.adult_actual_cost}元-儿童{$s_hotel.child_actual_cost}元-->
                                    <input type="checkbox" id="day[{$vo.current_day}][upgrade_lodging][{$s_hotel.room_price_id}]"  name="day[{$vo.current_day}][upgrade_lodging][]" {$s_hotel.checked} value="{$s_hotel.up_hotel_id}"></label>
                            </volist>
                            <hr>
                        </volist>
                        <!--<input type="text"  name="day[{$vo.current_day}][lodging]" value="{$vo.lodging}" class="form-control" placeholder="住宿">-->
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label"><font color="red">*</font>游玩景区：</label>
                    <div class="col-sm-8">
                        <volist name="vo['scenic']" id="scenic">
                            <label  style="margin-right:20px;" for="day[{$vo.current_day}][scenic_spot][{$i}]">{$scenic.supplier_name}-{$scenic.scenic_name}<!-- -{$scenic.scenic_level}A级-成人{$scenic.adult_actual_cost}元-儿童{$scenic.child_actual_cost}元-->
                                <input type="checkbox" id="day[{$vo.current_day}][scenic_spot][{$i}]"  name="day[{$vo.current_day}][scenic_spot][]" {$scenic.checked} value="{$scenic.scenic_priceId}"></label>
                        </volist>
                        <hr>
                        <!--<input class="form-control" type="text" name="day[{$vo.current_day}][scenic_spot]" value="{$vo.scenic_spot}" placeholder="游玩景区">-->
                    </div>
                </div>
                    <!--<div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>住宿：</label>
                        <div class="col-sm-8">
                            <input type="text"  name="day[{$vo.current_day}][lodging]" value="{$vo.lodging}" class="form-control" placeholder="住宿">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>游玩景区：</label>
                        <div class="col-sm-8">
                            <input class="form-control" type="text" name="day[{$vo.current_day}][scenic_spot]" value="{$vo.scenic_spot}" placeholder="游玩景区">
                        </div>
                    </div>-->
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>活动安排：</label>
                        <div class="col-sm-8">
                            <textarea required id="editor{$vo.current_day}" class="textarea" type="text" name="day[{$vo.current_day}][scenic_details]" >{$vo.trip_details}</textarea>
                        </div>

                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>游玩项目：<div class="btn btn-primary" onclick="addPlayTr({$vo.current_day})" data-name="">添加</div></label>
                        <div class="col-sm-8">
                            <table class="table table-striped table-bordered table-hover table-condensed " id="addPlayTr_{$vo.current_day}" data-currday="{$vo.current_day}">
                                <tr >
                                    <th>名称</th>
                                    <th>参考价值</th>
                                    <th>详情备注</th>
                                    <th class="operator">操作</th>
                                </tr>
                                <volist name="vo['play']" id="vvo">
                                    <tr >
                                        <td><input type="text" value="{$vvo.name}" name="day[{$vo.current_day}][play][{$i}][name]"></td>
                                        <td><input type="text"  value="{$vvo.price}"  name="day[{$vo.current_day}][play][{$i}][price]" onkeyup="this.value=this.value.replace(/\D/g,'')"
                                                   onafterpaste="this.value=this.value.replace(/D/g,'')"></td>
                                        <td><input type="text" value="{$vvo.note}" name="day[{$vo.current_day}][play][{$i}][note]"></td>
                                        <td><span class="btn btn-xs btn-primary delTr">删除</span></td>
                                    </tr>
                                </volist>
                            </table>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-2 control-label"><font color="red">*</font>购物项目：<div class="btn btn-primary" onclick="addShoppingTr({$vo.current_day})">添加</div></label>
                        <div class="col-sm-8">
                            <table class="table table-striped table-bordered table-hover table-condensed" id="addShoppingTr_{$vo.current_day}" data-currday="{$vo.current_day}">
                                <tr >
                                    <th>名称</th>
                                    <th>营业产品</th>
                                    <th>停留时间</th>
                                    <th>说明</th>
                                    <th class="operator">操作</th>
                                </tr>
                                <volist name="vo['shopping']" id="svo">
                                    <tr >
                                        <td><input type="text" value="{$svo.shopping_name}" name="day[{$vo.current_day}][shopping][{$i}][shopping_name]"></td>
                                        <td><input type="text" value="{$svo.product}" name="day[{$vo.current_day}][shopping][{$i}][product]"></td>
                                        <td><input type="text" value="{$svo.stay_time}" name="day[{$vo.current_day}][shopping][{$i}][stay_time]"></td>
                                        <td><input type="text" value="{$svo.instructions}" name="day[{$vo.current_day}][shopping][{$i}][instructions]"></td>
                                        <td><span class="btn btn-xs btn-primary delTr">删除</span></td>
                                    </tr>
                                </volist>
                            </table>
                        </div>
                    </div>
                </div>
            </volist>
            <div class="row text-center" >
                <a href="{:U('form_step2',array('id'=>I('id')))}" class="btn btn-info">上一步</a>
                <input type="submit" class="btn btn-warning" value="保存 进入下一步" />
                <a href="{:U('form_step4',array('id'=>I('id')))}" class="btn btn-info">跳过</a>
            </div>
        </form>
    </div>
</block>
<block name="js">
    <!-- 模糊匹配添加旅游项目购物项目事件 -->
    <script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.all.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="__STATIC__/Dealer/js/line.js"></script>
    <script>
        $(document).ready(function(){
            $(".div-tab-head>li").click( function(){
            var index=$(this).index();
            var div_index = parseInt(index)+1;
            // console.log("div[class='travel_detail-"+div_index+"']");
            $("#someday").val(div_index);
            //隐藏全部，然后显示当前的div
            console.info(index);
            $("div[class^='travel_detail']").hide();
            $(".travel_detail-"+div_index).show();

            $(this).addClass("head-on").siblings().removeClass("head-on");


            $(".day-item").addClass("day-item-on").eq(index).siblings(".day-item").removeClass("day-item-on");
        });
        })
    </script>

    <!-- 配置文件 -->
    <script type="text/javascript" src="__ROOT__/Public/ueditor1_4_3_3/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="__ROOT__/Public/ueditor1_4_3_3/ueditor.all.js"></script>
    <script src="__PUBLIC__/plugins/formValidator/formValidator-4.1.3.js"></script>
    <script>
        var ue;

        $(function () {
            <volist name="trip" id="vo">
            var ue = UE.getEditor('editor{$vo.current_day}', {
                toolbars: [
                    [
                        'fullscreen',
                        'source',
                        'undo',
                        'redo',
                        'bold',
                        'fontsize',
                        'simpleupload', //单图上传
                        'insertimage', //多图上传
                        'justifyleft', //居左对齐
                        'justifyright', //居右对齐
                        'justifycenter', //居中对齐
                        'justifyjustify', //两端对齐
                        'edittip ', //编辑提示
                        'drafts', // 从草稿箱加载
                    ]
                ],
                //initialFrameWidth:800,
                initialFrameHeight:300,
                autoHeightEnabled: true,
                autoFloatEnabled: true
            });
            </volist>


        });
    </script>



</block>
